package com.spring.ioc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest {
    public static void main(String[] args) {
        // 1.解析配置文件：
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        // 控制反转(IOC): 创建、维护对象关系 由 调用者 转由 Spring容器(IOC)容器 进行操作
//        Student student = (Student) context.getBean("student");
//        System.out.println(student);

        // 对象注入(DI)
        XxxServlet xxxServlet = (XxxServlet) context.getBean("xxxServlet");
        xxxServlet.select();
    }
}
